import Cookie from 'js-cookie'
export function setCookie (key: string, value: string, days?: number): void {
  if (window.localStorage) {
    localStorage.setItem(key, value)
  } else {
    Cookie.set(key, value, { expires: days })
  }
}

export function getCookie (key: string): null | undefined | string {
  if (window.localStorage) {
    return localStorage.getItem(key)
  } else {
    return Cookie.get(key)
  }
}

export function removeCookie (key: string): void {
  if (window.localStorage) {
    localStorage.removeItem(key)
  } else {
    Cookie.remove(key)
  }
}
